<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
use app\common\widgets\MyFileUpload;

/* @var $this yii\web\View */
/* @var $model app\models\GkyWeArticleType */
/* @var $form yii\widgets\ActiveForm */
?>

<script type="text/javascript" src="js/qiniuupload/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="js/qiniuupload/plupload/plupload.full.min.js"></script>
<script type="text/javascript" src="js/qiniuupload/plupload/i18n/zh_CN.js"></script>
<script type="text/javascript" src="js/qiniuupload/ui.js"></script>
<script type="text/javascript" src="js/qiniuupload/qiniu.js"></script>
<script type="text/javascript" src="js/qiniuupload/highlight/highlight.js"></script>
<script type="text/javascript" src="js/qiniuupload/main.js"></script>

<div class="gky-we-article-type-form">
    <div class="panel panel-default">
        <div class="panel-body">
            <?php
            $form = ActiveForm::begin([
                        'options' => ['class' => 'form-horizontal form-group'],
                        'fieldConfig' => [
                            'template' => "{label}<div class=\"col-lg-10\">{input}</div>",
                            'labelOptions' => ['class' => 'col-lg-2 control-label'],
                        ]
            ]);
            ?>

            <div class="col-lg-6 col-xs-12 col-sm-6 col-md-6">

                <?php
                $data = \app\models\GkyWeAccount::find()->all();
                echo $form->field($model, 'weid')->dropDownList(
                        \yii\helpers\ArrayHelper::map($data, 'id', 'wename'));
                ?>


            </div>
            <div class="col-lg-6 col-xs-12 col-sm-6 col-md-6">
                <?= $form->field($model, 'typename')->textInput(['maxlength' => true]) ?>
            </div>

            <!--去掉父级菜单，原来微信自定义菜单，后来改为九宫格显示菜单后，该字段没用了-->
            <!--            <div class="col-lg-4 col-xs-12 col-sm-4 col-md-4">
            
            <?php
//                $data = \app\models\GkyWeArticleType::find()->all();
//                echo $form->field($model, 'parentid')->dropDownList(
//                        \yii\helpers\ArrayHelper::map($data, 'id', 'typename'), ['prompt' => '请选择父级菜单'])->label('父级名称');
            ?>
                        </div>-->

            <!--判断是否为新增栏目-->
            <?php if ($model->isNewRecord) { ?>
                <div class="hidden col-lg-4 col-xs-12 col-sm-4 col-md-4">
                    <?php echo $form->field($model, 'isnew')->textInput(['maxlength' => true, 'value' => '1']) ?>
                </div>

                <div class="col-lg-12 col-xs-12 col-sm-12 col-md-12">
                    <?php // echo $form->field($model, 'imagepath')->textInput(['maxlength' => true]) ?>
                </div>

                <label class="col-lg-2 control-label" for="gkywearticletype-weid">上传栏目图标</label>
                <div style="margin:5px">
                    <?= MyFileUpload::widget() ?>
                </div>

                <div style="margin:0 0 15px 15px">
                    <a href="http://www.iconfont.cn/collections?personal=1" class="glyphicon glyphicon-hand-right" target="blank"><span style="margin-left: 5px">推荐图标下载地址</span></a>
                </div>
            <?php }else{
                    if($model->imagepath){
                ?>
                <label class="col-lg-2 control-label">上传栏目图标</label>
                <div style="margin:5px">
                    <?= MyFileUpload::widget() ?>
                </div>
                <div style="margin:0 0 15px 15px">
                    <a href="http://www.iconfont.cn/collections?personal=1" class="glyphicon glyphicon-hand-right" target="blank"><span style="margin-left: 5px">推荐图标下载地址</span></a>
                </div>
                <label class="col-lg-2 control-label">新增的栏目图标</label>
                <?php  echo Html::img($model->imagepath); ?>
            <?php }}?>





            <div class="col-lg-12 col-xs-12 col-sm-12 col-md-12">
                <div class="form-group">
                    <?= Html::submitButton('保存', ['class' => 'btn btn-success col-lg-offset-5 col-md-offset-5']) ?>
                    <?= Html::a('返回', ['index'], ['class' => 'btn btn-primary']) ?>
                </div>
            </div>

            <?php ActiveForm::end(); ?>
        </div>
    </div>

</div>
